import http from "@/api";
import qs from "qs";
//获取发布列表
export const getReleaseList = params => {
  console.log(params);
  return http.post(
    "pages/release!findReleasePager.action",
    qs.stringify({
      "releaseQueryDTO.loginName": params.loginName,
      _search: false,
      rows: params.pageSize,
      page: params.pageNum,
      sidx: "eno",
      sord: "desc"
    })
  );
};
// 上传文件
export const uploadFile = (params: FormData) => {
  return http.post(`/pages/uploadFile!uploadAttr.action?tenantId=yuehaishuiwu_zhengshi`, params);
};
//获取优先级
export const getPriority = () => {
  return http.post(`/pages/dataDictionaryItems!findByCode.action?dataDictionaryQueryDto.groupCode=priority`);
};
//获取发布分类
export const getReleaseType = () => {
  return http.post(`/pages/event!getCategoryTreeAllData.action?flag=dataDic&num=50&types=Release&parentEventId=0`);
};
//新增发布
export const addRelease = params => {
  return http.post(`/pages/release!saveRelease.action`, qs.stringify(params));
};
//编辑发布
export const editRelease = params => {
  return http.post(`/pages/release!updateRelease.action`, qs.stringify(params));
};
//删除发布
export const delRelease = params => {
  return http.post(`/pages/release!deleteRelease.action?` + params);
};
//发布详情
export const getReleaseInfo = params => {
  return http.post(`/pages/release!findById.action?releaseDTO.eno=` + params);
};
//提交发布详情计划描述
export const submitReleaseInfo = params => {
  return http.post(`/pages/release!saveSolutions.action`, qs.stringify(params));
};
//查找附件
export const findFile = params => {
  return http.post(`/pages/eventAttachment!findAllEventAttachment.action`, qs.stringify(params));
};
//删除附件
export const delFile = params => {
  return http.post(`/pages/eventAttachment!deleteEventAttachment.action`, qs.stringify(params));
};
//获取被指派人信息
export const getAssignUser = params => {
  return http.post(`/pages/user!findByUserName.action`, qs.stringify(params));
};
//获取指派用户列表
export const getUserList = params => {
  console.log(params);
  return http.post(
    `/pages/user!find.action?` + params.belongGroupIds,
    qs.stringify({
      state: true,
      _search: false,
      rows: params.pageSize,
      page: params.pageNum,
      sidx: "userId",
      sord: "desc",
      "userQueryDto.companyNo": 1
    })
  );
};
//指派技术员
export const assignUser = params => {
  return http.post(`/pages/release!releaseAction.action`, qs.stringify(params));
};
//任务重新指派
export const reAssignUserApi = params => {
  return http.post(`/pages/flowProperty!findFlowActivityById.action`, qs.stringify(params));
};
export const reAssignUser = params => {
  return http.post(`/pages/release!assignTask.action`, qs.stringify(params));
};
//获取开启流程用户信息
export const getOpenUser = params => {
  return http.post(`/pages/release!findProcessAssignDTO.action`, qs.stringify(params));
};
//开启流程
export const openProcessAction = params => {
  return http.post(`/pages/release!openProcess.action`, qs.stringify(params));
};
//动作流程
export const actionProcessApi = params => {
  return http.post(`/pages/release!processHandle.action`, qs.stringify(params));
};
//重新开启
export const reStartProcess = params => {
  return http.post(`pages/release!releaseAction.action`, qs.stringify(params));
};
//获取流程信息
export const getProcessInfo = params => {
  return http.post(`/pages/jbpm!getActivityCoordinates.action?pid=` + params);
};
//编辑新增附件
export const editAddAttachment = params => {
  return http.post(`/pages/eventAttachment!saveEventAttachment.action`, qs.stringify(params));
};
